package action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author:石小俊
 * @Date:2022/12/29 9:26
 * @Version:1.0-SNAPSHOT
 * @Description:
 */
public class UserAction {

    public String register(HttpServletRequest request, HttpServletResponse response){
        String username = request.getParameter("username");
        if("admin".equals(username)){
            request.setAttribute("registerMsg","用户名已经被注册");
            return "fail";
        }
        return "success";
    }

    public String login(HttpServletRequest request, HttpServletResponse response){
        String username = request.getParameter("username");
        if("admin".equals(username)){
            return "success";
        }
        request.setAttribute("loginMsg","用户名或密码错误");
        return "fail";
    }
//    public String login(){
//        System.out.println("UserAction.login");
//        return "xxx";
//    }
//    public String register(HttpServletResponse response,HttpServletRequest request){
//        System.out.println("UserAction.register");
//        return "xxx";
//    }

}
